﻿using System.Web.Mvc;
using Vit.Web.Mvc.Results;

namespace Vit.Web.Mvc.Filters
{
    public class ErrorExceptionFilter : IExceptionFilter
    {
        #region IExceptionFilter Members

        public void OnException(ExceptionContext filterContext)
        {
#if DEBUG
            filterContext.HttpContext.AddError(filterContext.Exception);
#endif
            filterContext.ExceptionHandled = true;

            filterContext.Result = new PartialErrorResult();
        }

        #endregion
    }
}
